<X::DropdownList
  data-test-header-sort-by-dropdown
  @items={{@facets}}
  @placement={{@dropdownPlacement}}
  @renderOut={{true}}
>
  <:anchor as |dd|>
    <dd.ToggleButton
      data-test-header-sort-dropdown-trigger
      @text="Sort: {{@label}}"
      disabled={{@disabled}}
    />
  </:anchor>
  <:item as |dd|>
    <dd.LinkTo
      @query={{hash
        sortBy=(if (eq dd.value "Newest") this.dateDesc this.dateAsc)
      }}
    >
      <FlightIcon
        data-test-facet-dropdown-list-item-sort-icon
        @name={{if (eq dd.value "Newest") "sort-desc" "sort-asc"}}
        class="sort-icon"
      />
      {{dd.value}}
    </dd.LinkTo>
  </:item>
</X::DropdownList>
